<template>
  <div class="copyright" v-if="isShow" @click="changeAccount">
    <div class="img">
      <img src="@/assets/images/logo-gray.png" />
    </div>
    <div class="txt">{{text}}提供技术支持</div>
  </div>
</template>

<script>
import VConsole from 'vconsole';
// import {vconsole} from 'utils/Cache';
import Storage from '@/utils/storage'
import config from '@/config/config'
import {isAgents} from 'api/common/common.js'
const storage = new Storage()
export default {
  data() {
    return {
      isShow: false, //是否显示 默认显示
      text: "小羊云商",

      num:0,//点击次数
      timer0:'',//第一次点击的时间
      timer4:'',//第四次点击的时间
      centerDialogVisible: false,
      ShowAgents: false
    };
  },
  mounted () {
    if (storage.get(config.StorageVconsole)) {
      let vConsole = new VConsole()
    }
    !this.isShow && this.getisAgents()
    
  },
  methods: {
    getisAgents() {
      isAgents().then(res => {
        if (res.status != 1) {
          this.$toast(res.msg)
          return
        }


        this.isShow = !res.result

      })
    },
    changeAccount(){
     
      if (storage.get(config.StorageVconsole)) {
        return
      }


      this.num++
      if(this.num == 1){
        this.timer0 = new Date().getTime() / 1000
      }
      
      if(this.num == 4 ){
        this.timer4= new Date().getTime() / 1000
        if(this.timer4 - this.timer0 <= 1) {
          this.num = 0
          let vConsole = new VConsole();
          storage.set(config.StorageVconsole, config.StorageVconsole, 86400000)
        } else {
          this.num = 0
        }
      }
    }
  },
};
</script>

<style lang="stylus" scoped>
.copyright {
  padding: 20px 0;
}

.copyright .img {
  width: 100%;
  font-size: 0;
  text-align: center;
}

.copyright .img img {
  max-width: 84px;
  height: 28px;
}

.copyright .txt {
  color: #bbbbbb;
  font-size: 11px;
  height: 13px;
  line-height: 13px;
  text-align: center;
  margin-top: 5px;
}

.copyright .txt img {
  width: 13px;
  height: 13px;
  display: inline-block;
  vertical-align: top;
  margin-right: 3px;
}
</style>